package com.example.factory.api.utils;

import cn.hutool.core.lang.UUID;
import cn.hutool.crypto.digest.MD5;

/**
 * @author Lei Tao
 */
public class MD5Utils {

    public static String createUserPassword(String password) {
        MD5 md5 = MD5.create();
        String digestHex16 = md5.digestHex16(password);
        UUID uuid1 = UUID.fastUUID();
        String salt1 = uuid1.toString().substring(0, 8);
        UUID uuid2 = UUID.fastUUID();
        String salt2 = uuid2.toString().substring(0, 8);
        System.out.println(digestHex16);
        return salt1 + digestHex16 + salt2;
    }

    public static String getUserPassword(String password){
        return password.substring(8,24);
    }

}
